package dem2;

/**
 * Created with Intellij IDEA.
 * Description:
 * User: 33013
 * Date: 2023-03-29
 * Time: 22:32
 */

class Login{
    private String username = "admin";
    private String password = "213454";

    public void loginInfo(String username,String password) throws UserException{
        if(!this.password.equals(password)){
            //System.out.println("密码错误");
            throw new PassWordException(password + "错误");
        }
        if (!this.username.equals(username)){
            //System.out.println("用户名错误");
            throw new UserException(password);
        }
        System.out.println("登录成功");
    }

    public static void main(String[] args) {
        Login login = new Login();
        try {
            login.loginInfo("sadss","134342");
        }catch (PassWordException e){
            e.printStackTrace();
        }catch (UserException e){
            e.printStackTrace();
        }
    }

}

public class Test {


    public static void main(String[] args) {

    }
}
